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