UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/bFOIPejRL37Qr3PWWdgoSmy+cgwV8dRIcVt1HcomLw='
WHERE
key_id = '50617ac298a57e3cf1d671c48286c8a18d10f8c7d6045a6d9345556fe6384765'
AND (
token = '/bFOIPejRL37Qr3PWWdgoSmy+cgwV8dRIcVt1HcomLw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)