UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xwd5I/lEeHvYd3yTJZWPRwj+GFHVXX/gNAMItMO17J4='
WHERE
key_id = 'e1567ea0151f274ec00b34d5327fdfdd04eaa52107c6592a8f66cbe02478792c'
AND (
token = 'Xwd5I/lEeHvYd3yTJZWPRwj+GFHVXX/gNAMItMO17J4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)