UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QhzCieSTPWIkTtFBZFcxEPBzs395nsEMKyLdLrLohG0=' 
WHERE 
  key_id = '8801bf0793c06c2e13155665ddf40c81bd6487e5394e799865c84c55a8c02b64' 
  AND (
    token = 'QhzCieSTPWIkTtFBZFcxEPBzs395nsEMKyLdLrLohG0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039