UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iNUPILRg+6IrRE35+xShW6c74N0A8soFyEW1hQqhx2U=' 
WHERE 
  key_id = 'f01c89ee1085ef6f685ebbed54262de521abfa4d13b4deb9eff070488e58d313' 
  AND (
    token = 'iNUPILRg+6IrRE35+xShW6c74N0A8soFyEW1hQqhx2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035