UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FeNy3FEbtm0wlUgg9MCnncGAlcempzdHtlFLFEyo8n4='
WHERE
key_id = '844cf71857f3bbdc0b9f374b1c321bafcac93da2724071372d0d4fc93d509fe8'
AND (
token = 'FeNy3FEbtm0wlUgg9MCnncGAlcempzdHtlFLFEyo8n4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)