UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DvmtlJ+hMRG6QUQ0jYhQ9iVNvXznlJoz43bJ+RRaDgo='
WHERE
key_id = '2e515b8e8bf259f42b38e889829c173017476248a5f3e3268590be1fcb37d2ed'
AND (
token = 'DvmtlJ+hMRG6QUQ0jYhQ9iVNvXznlJoz43bJ+RRaDgo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)