UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qoo7QSm3P9bd8Rw0B97cEbTNI2Lqw+WbYhXqsWcCNko=' 
WHERE 
  key_id = '478ed31142c57aa6c9775d0e78f0a4829cc4e45cfdc7bcd531782bc5a8c66ea8' 
  AND (
    token = 'qoo7QSm3P9bd8Rw0B97cEbTNI2Lqw+WbYhXqsWcCNko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037