UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z6EkbyUh/5e82vP38rwlpBGuLZeTGDcDOkESSLSI8mM='
WHERE
key_id = '5ffa43eedc32884a307f0ab72b803918fe5496d81c59177a5e08d3bea9a7b240'
AND (
token = 'z6EkbyUh/5e82vP38rwlpBGuLZeTGDcDOkESSLSI8mM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)