UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kkOIESwV7gbpcUXzx4knRuMrYVvPwyAKwXnruw0J/RI=' 
WHERE 
  key_id = '42ef268cd2aba8915a8a5e02ab2b6b168d90d9e421f6a8d0d235920047681800' 
  AND (
    token = 'kkOIESwV7gbpcUXzx4knRuMrYVvPwyAKwXnruw0J/RI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031