UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pZ5OpnPQOJ/SzL+V2F7dZUEY837rql/OCG+sCBnYxs8=' 
WHERE 
  key_id = '4322875ed491a73e22e4a9df345498d8f511aeccef033f9234c3c2dc35c684a3' 
  AND (
    token = 'pZ5OpnPQOJ/SzL+V2F7dZUEY837rql/OCG+sCBnYxs8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023