UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UIqy+KJBP6Evc2tkz3FENs4S5YMcRGbiChYJ+B0rKso=' 
WHERE 
  key_id = '9d016ac33415b42b48e5f61bad9148cdb11978a0a1413d705b832e9deba7f1d0' 
  AND (
    token = 'UIqy+KJBP6Evc2tkz3FENs4S5YMcRGbiChYJ+B0rKso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061