UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sgDgjdbV/jYv/6R03knOF7ISufLlxhkfVYCxDq2ToDY='
WHERE
key_id = 'ab0e67e8af7d583e020e46ee344e481cf387cdd462e6598382f58433a45b67d2'
AND (
token = 'sgDgjdbV/jYv/6R03knOF7ISufLlxhkfVYCxDq2ToDY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)