UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Rz819kxyLbG5/UIW4VsoaJD3P/J6lqj3ootipyT0Ox8='
WHERE
key_id = 'b563855b0f8ceced33fc94c6f5a80468697fbd74e700f3ccc64143be38b46f5c'
AND (
token = 'Rz819kxyLbG5/UIW4VsoaJD3P/J6lqj3ootipyT0Ox8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)