UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bDVJxLuiYkMzh1ANg2QLnwdd3Ge3E39Nej5v+SywP/Y=' 
WHERE 
  key_id = 'da975747408845e377d080210b423b1d36b7d5375645df4a7dc67d68a4baff3d' 
  AND (
    token = 'bDVJxLuiYkMzh1ANg2QLnwdd3Ge3E39Nej5v+SywP/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017