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