UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rv0UI/iTNyYIqW95NOH4SZb6xO6mAzQQZxYWBAntdSg=' 
WHERE 
  key_id = '9c77f46d2b467b347e8ad766a403d1a1fada6a96772c574bfb8227542eabd597' 
  AND (
    token = 'rv0UI/iTNyYIqW95NOH4SZb6xO6mAzQQZxYWBAntdSg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025