UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oDGJWfvxbBbg7AjEp2sBibbOrdhYcCA3uO7dFou7k1w='
WHERE
key_id = 'd90ed6de77b773ca65fe184a20dc6966da0cae881a806de1db403cd45200d838'
AND (
token = 'oDGJWfvxbBbg7AjEp2sBibbOrdhYcCA3uO7dFou7k1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)