UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NUsho8YYN8mLF6obqNI+6X46GcvPP7I7qZOeUeCNQV0=' 
WHERE 
  key_id = '03eb8c947606508f271355bb1f74d24a216a6716b300c5d0138320f66687684a' 
  AND (
    token = 'NUsho8YYN8mLF6obqNI+6X46GcvPP7I7qZOeUeCNQV0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026