UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o2UPkjo7xnP5qbIkLXIPcIcuHY1T0Lwdpucr1ZPwh/w=' 
WHERE 
  key_id = '8b6450c602c08627d3591c0ea21a010c7dac4c24d0a88dab59525c8d8cc0a2c9' 
  AND (
    token = 'o2UPkjo7xnP5qbIkLXIPcIcuHY1T0Lwdpucr1ZPwh/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048