UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZUVhRMShV4RPD0sEb+cdLkEr/ZRuoDebo1hsrknWKyY=' 
WHERE 
  key_id = 'dd816204436dd47f97cb0e8b65c8e7b108f69e439f19ddc5ec737c0069251d04' 
  AND (
    token = 'ZUVhRMShV4RPD0sEb+cdLkEr/ZRuoDebo1hsrknWKyY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030