UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gp4rmCW61UDCYzwLmiSON1OyRIPqtzYHi9TUp9BYMQk=' 
WHERE 
  key_id = '36740781fb9a1f6c6350cc8985190179b5a1be506ed3027c24649beb2e7e34b8' 
  AND (
    token = 'Gp4rmCW61UDCYzwLmiSON1OyRIPqtzYHi9TUp9BYMQk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026