UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T49al9c3PqkRpUABHaWn95HIWEhMMJIEoPwE0Ykod+k=' 
WHERE 
  key_id = '38231aa53ba06593cce030b912e9a7a4ace49d00fc50935aa29d38071c4f8279' 
  AND (
    token = 'T49al9c3PqkRpUABHaWn95HIWEhMMJIEoPwE0Ykod+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027