UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8pm8jvC7at/hVZxr4MGipSrAjwMIIr02sVTtUxI9zKg='
WHERE
key_id = 'b50987b097afa05043d31de973d571653bcaf89d2d8b825749e4f6223edb7a2f'
AND (
token = '8pm8jvC7at/hVZxr4MGipSrAjwMIIr02sVTtUxI9zKg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)