UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6p0MndWrVrgRdwxSaTYq6ip8apws0FMu8A4/DiS6YMk='
WHERE
key_id = '7d415e6e6867a8cd9306c04dc8fc9343e868df3ec949cd4e701bd67916c79c75'
AND (
token = '6p0MndWrVrgRdwxSaTYq6ip8apws0FMu8A4/DiS6YMk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)