UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W3DqUa2F2xyxS3Zn/BE1vZdtC7ffN2O7gPOUDg9QiRA='
WHERE
key_id = '32c2391338df4863f0406cb3d10e0ca96eda1d13e334168e1b8e794f9f31dd6a'
AND (
token = 'W3DqUa2F2xyxS3Zn/BE1vZdtC7ffN2O7gPOUDg9QiRA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)