UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G8YrJuy8/7PO+mKJgLHV94uta+vCxopcpwBjr/Zt9Ks=' 
WHERE 
  key_id = '5162d4de09848dd30b45a0d54829dcb50abbb127385b6c64ed03572ad783fcc4' 
  AND (
    token = 'G8YrJuy8/7PO+mKJgLHV94uta+vCxopcpwBjr/Zt9Ks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071