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