UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O7jU+Z9o443Ch0A3ZC7S+0f4l/hj8vTihmNdamkghyA=' 
WHERE 
  key_id = 'd93eb1adc4d2084c762d878015b4d14834ca8d173683bd8579791711c397499b' 
  AND (
    token = 'O7jU+Z9o443Ch0A3ZC7S+0f4l/hj8vTihmNdamkghyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050