UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JkVx0Cc4zY5xyg6EZ0fBQyH3pjCcR7u+no9rFUxdSYc=' 
WHERE 
  key_id = '2151398e9ff19b783892c6c6b1267218fc4caabd876c78ec010a79df989b664f' 
  AND (
    token = 'JkVx0Cc4zY5xyg6EZ0fBQyH3pjCcR7u+no9rFUxdSYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028