UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y3YCw69ZwE41ClpRTARvc2u57CDuhgsvwYd7kPN7Elk='
WHERE
key_id = 'd8c9a96016a4d0d7354befef9cbd48ab005d3577cd10f41c54644a747c7e07a0'
AND (
token = 'Y3YCw69ZwE41ClpRTARvc2u57CDuhgsvwYd7kPN7Elk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)