UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u9SyxqYqZBNlNbJTOjbl7HuOhU2lzpqNWg5tO3YIY3o='
WHERE
key_id = '9a39e7c6692feeaeed0e3c9ce474ffece99b29a8ae46b592a7a304790b79711e'
AND (
token = 'u9SyxqYqZBNlNbJTOjbl7HuOhU2lzpqNWg5tO3YIY3o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)