UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9IlgDAnrhE4SAerffioRNpe08quRAkpDgti3L0XEbx0=' 
WHERE 
  key_id = '16d1bef435a49aa11eceb6de5ca1ebadb19f3a749d450ee4eca120fdbb172312' 
  AND (
    token = '9IlgDAnrhE4SAerffioRNpe08quRAkpDgti3L0XEbx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050