UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CcM18Bd3MCFz2uvyJ0C1EhKYWjOplRlOfudGg+dVdTQ=' 
WHERE 
  key_id = 'b042e0e23acb9d1093d5793fcf0555d7dc168a2cd7f6e5bd8d5397a1cd62115f' 
  AND (
    token = 'CcM18Bd3MCFz2uvyJ0C1EhKYWjOplRlOfudGg+dVdTQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033