UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kXoNKMXda++786dlZdD4VO89PXuLakF4/6FDcfoLfO0=' 
WHERE 
  key_id = '4c01c8c4688750b2d51b4997a282b0938b7c549e13efd497e3899680cd81b71f' 
  AND (
    token = 'kXoNKMXda++786dlZdD4VO89PXuLakF4/6FDcfoLfO0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029