UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W6sFCX08OlXhLOKCpQ5cfMzstybJ86Abnh6p+jrCRY0=' 
WHERE 
  key_id = 'db081d6357711824c8be0d15fed3b454794f237345793241f8e99248d3f81a34' 
  AND (
    token = 'W6sFCX08OlXhLOKCpQ5cfMzstybJ86Abnh6p+jrCRY0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036