UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1rRVmh6JBDX7tsAASPnzJmLSuFVqmBBBwEwfA6hacwg='
WHERE
key_id = '04eba94e4953304a145804b6667c44dd6301b46cea975e7731989e4b4c580bb4'
AND (
token = '1rRVmh6JBDX7tsAASPnzJmLSuFVqmBBBwEwfA6hacwg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)