UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VCqQ2aCLrYYe9WeeyxFdslt2bojybNL6iUlBBoPqB0o='
WHERE
key_id = '5a521bddc07e0674d39461eb9a90bb42b23bb7f507910106a706c08a7b5d3892'
AND (
token = 'VCqQ2aCLrYYe9WeeyxFdslt2bojybNL6iUlBBoPqB0o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)