UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QK0RQ3W7+7mTwSscrSeUKIYPBjVHr4YU3EiN7Ft1DMw=' 
WHERE 
  key_id = '38dca3e97719d7154b7b8fed40896942faa1421c63bb2c31b2d3f42047af3aa9' 
  AND (
    token = 'QK0RQ3W7+7mTwSscrSeUKIYPBjVHr4YU3EiN7Ft1DMw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034