UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2idEa16+RMkF8byoadhMBOIWPOuM1ZmVGDTx2nDGGV4='
WHERE
key_id = 'e74d1802c1540846ad6827fd8307f953d3a5693e6b9a73c2a57029273e691cb4'
AND (
token = '2idEa16+RMkF8byoadhMBOIWPOuM1ZmVGDTx2nDGGV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)