UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1rn3DvQDIXyKpMioa3MM4dy3GJdNDMdoYOQP17atS0Y='
WHERE
key_id = '1d5e451d97c825f41703f3caa2e067b15c0d95c255f1e0a1136f55d05ad60277'
AND (
token = '1rn3DvQDIXyKpMioa3MM4dy3GJdNDMdoYOQP17atS0Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)