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