UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GPgOQXDI7lftIm4g5kDIzIG91bzo5C1Zwui5GNhhJEY='
WHERE
key_id = 'b3c76115a9b59b08f7e8a484a164666296a9767d2afa7bbca825e05d5c7e7795'
AND (
token = 'GPgOQXDI7lftIm4g5kDIzIG91bzo5C1Zwui5GNhhJEY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)