UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Te6jr3HeEacfHY8Xlmb4bmvPUCXxfG8/r4p21hy4IHg='
WHERE
key_id = 'c7ddd11062f02d06ed3b95ece1ed30fcc3d883e2f58b8dfdfc073ee7dc2e21b5'
AND (
token = 'Te6jr3HeEacfHY8Xlmb4bmvPUCXxfG8/r4p21hy4IHg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)