UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bg5LZx01yxXeTka3QcfqNHtWaTNOp1fcnVkDhL/FsL0=' 
WHERE 
  key_id = 'd16cc6b99b8524e6e4b6de8b3f16d976d2f5d43ef17cc9dd35ebbc7c38229223' 
  AND (
    token = 'Bg5LZx01yxXeTka3QcfqNHtWaTNOp1fcnVkDhL/FsL0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055