UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aHQFGTUSsg3CWlKtlpvdNbqGSh8dDf825njhz6UAAbs='
WHERE
key_id = '8a1f2536d61c8f5a72b4824a5af566ee87a31ffab9313237f807e03149054a68'
AND (
token = 'aHQFGTUSsg3CWlKtlpvdNbqGSh8dDf825njhz6UAAbs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)