UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5JEOS5s3xlf+D/hdWhydQr/Q1p8Aoa296Qt6jWoTaU8='
WHERE
key_id = 'e5fb8efe904e5b2a2574c199c37bf7a107b13266cf9d1f9da5928e5de911ddc2'
AND (
token = '5JEOS5s3xlf+D/hdWhydQr/Q1p8Aoa296Qt6jWoTaU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)