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