UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zy1SxHpXGASxhvPaXdDSf+5xy8ef9bFDbWR9FxBh4yg='
WHERE
key_id = '979854e1b3a7a18a0a4a6e140466079730ccba76d83441db22232abf9a9dd252'
AND (
token = 'Zy1SxHpXGASxhvPaXdDSf+5xy8ef9bFDbWR9FxBh4yg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)