UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h1tt9RGCeROk+1E3z84IsuUi5LI6QDRx5P8woFUSqaU='
WHERE
key_id = 'f2589c1c656e4cc1a7b61a66bfd0022864026c2f900be03b44311092c35fdfb2'
AND (
token = 'h1tt9RGCeROk+1E3z84IsuUi5LI6QDRx5P8woFUSqaU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)