UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dW3zIfS6fbc3BpO4CjTh/882viA0UoNXJhfp29D0k3I=' 
WHERE 
  key_id = '1b52d96b737fa8eb0dc5ef0f87561fd8732a4556aa62bc707d021ad3d7693044' 
  AND (
    token = 'dW3zIfS6fbc3BpO4CjTh/882viA0UoNXJhfp29D0k3I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048