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