UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GjSsjoMDSOU4F70ovBVnaGZAS+oyKoyiqnWhHxWdHkY=' 
WHERE 
  key_id = '7828cb6f99e98153e188798368af23f19d3760b6a75235a90e02f8629f93eb7d' 
  AND (
    token = 'GjSsjoMDSOU4F70ovBVnaGZAS+oyKoyiqnWhHxWdHkY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042