UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h2gnyggrBz0HgmU98cVcxp0QZORmmYd+9ZmDCBegCPM=' 
WHERE 
  key_id = '547e8835dcdc7033a1f2d08ef342b0fb72dfa04912781c9f1eeaaece8914f2ae' 
  AND (
    token = 'h2gnyggrBz0HgmU98cVcxp0QZORmmYd+9ZmDCBegCPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057