UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5zsBP+HaVaRbGxZ9udiIvk0Zgiydke76gAjJmhH5DfQ='
WHERE
key_id = 'fe7d94cb3fa4263cbfe9992e4550176624c20150f390dd2ed3b7800b80c9310a'
AND (
token = '5zsBP+HaVaRbGxZ9udiIvk0Zgiydke76gAjJmhH5DfQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)