UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zGtE2lCXFuyCgJolAl//ZEzQT28S4lmQlsQccb0vQt4='
WHERE
key_id = 'e166f4e640730b690fcadfc9c1d968ac4d776a9a2913dfb94450b2da0b02d07e'
AND (
token = 'zGtE2lCXFuyCgJolAl//ZEzQT28S4lmQlsQccb0vQt4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)