UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EgwcH16gPU2qFE41KbtpgUIgkpdz/K+W3JTKDCVpEu4=' 
WHERE 
  key_id = '9d71dea713c5bff81b2d099181493d2782b989659bed8db08c1f10ac1cfb5289' 
  AND (
    token = 'EgwcH16gPU2qFE41KbtpgUIgkpdz/K+W3JTKDCVpEu4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040