UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hV8X3va4gUxTjhtdQ4W2lWA7g2DiXm5zxN7M/M15J5o='
WHERE
key_id = '505f372f8524f0daedee77c76cbd3390034f1dca96f0f3dd2ce70f325fa2dcea'
AND (
token = 'hV8X3va4gUxTjhtdQ4W2lWA7g2DiXm5zxN7M/M15J5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)